<?php
require('includes/top.php');

foreach($_POST as $key => $value)
{
if($value!="" && $value!="Save")
{
/*
echo $key;
echo '=';
echo $value;
echo '<br>';*/

$data = $key.'_'.$value;

$laptop_remarks_array = explode('_',$data);
if($laptop_remarks_array[0]=="laptopremarks" || $laptop_remarks_array[0]=="laptop")
{
$type = 'laptop';
$remarks = $laptop_remarks_array[2];
}
elseif($laptop_remarks_array[0]=="accessoriesremarks" || $laptop_remarks_array[0]=="accessories")
{
$type = 'accessories';
$remarks = $laptop_remarks_array[2];
}


$product_id = $laptop_remarks_array[1];
$sql="INSERT INTO replacement_request(`product_id`,`remarks`,type) VALUES ('$product_id','$remarks','$type')";
$result=mysql_query($sql);
}

}

if($result>0)
{
header('Location:request_replacement.php?v=success');
}
else
{
header('Location:request_replacement.php?v=err');
}
?>